const axios = require('axios')
const { apiHost } = require('../config')
/**
 * 响应 GET 请求（响应微信配置时的签名检查请求）
 */
async function get(ctx, next) {
  const { data}  = await axios.get(apiHost + '/topics/search', { params: ctx.query})

  ctx.body = data
}

async function findById(ctx, next) {
  // 检查签名，确认是微信发出的请求
  const { id } = ctx.params
  const {data} = await axios.get(apiHost + '/topics/' + id)

  ctx.body = data
}

module.exports = {
  findById,
  get
}